<?php
header("content-type:text/html;charset=utf8");
$phone = $_GET['phone'];
$password = $_GET['password'];
$con = mysqli_connect('localhost','root','root','2021');
mysqli_query($con,'set names utf8');
$res = mysqli_query($con,"select * from uss where phone='$phone'");
$row = mysqli_fetch_assoc($res);
if($row){
    $arr = [
        "meta"=>[
            "status"=>0,
            "msg"=>"用户名被占用"
        ],
        "data"=>null
    ];
}else{
    $res = mysqli_query($con,"insert uss(phone,password) values('$phone','$password')");
    if($res){
        $arr = [
            "meta"=>[
                "status"=>1,
                "msg"=>"注册成功"
            ],
            "data"=>null
        ];
    }else{
        $arr = [
            "meta"=>[
                "status"=>2,
                "msg"=>"注册失败"
            ],
            "data"=>null
        ];
    }
}
echo json_encode($arr);